/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once


/**
===============================
4 component Vector
===============================
*/
class Vector4f
{
public:
    Vector4f(void) { ZeroOut(); };
    Vector4f( float x, float y, float z, float w ) { Set(x,y,z,w); };
    Vector4f( float* data ) { Set( data ); };
    Vector4f( const Vector4f &v ) { Set( v ); };

    /*---------------------------------------
        Operator overloads
    ----------------------------------------*/
    inline Vector4f operator+( Vector4f &v)  const { return Add( v ); };
    inline Vector4f operator-( Vector4f &v)  const { return Subtract( v ); };
    inline Vector4f operator*( float scalar) const { return Multiply( scalar ); };
    inline Vector4f operator/( float scalar) const { return Divide( scalar ); };
    inline float    operator[]( int index )  const { return m_data[index]; };


    inline float GetX() const { return m_data[0]; };
    inline float GetY() const { return m_data[1]; };
    inline float GetZ() const { return m_data[2]; };
    inline float GetW() const { return m_data[3]; };

    /** Zero out the vector */
    void ZeroOut();
    /** Length/magnatude of the vector */
    float Length() const;
    /** Normalize the vector */
    void Normalize();
    /** Multiply two vectors */
    void Multiply( const Vector4f &v ); // TODO

    /** Multiply by a scalar */
    Vector4f Multiply( float scalar ) const;
    /** Divide by a scalar */
    Vector4f Divide( float scalar ) const;
    /** Add */
    Vector4f Add( Vector4f &v ) const;
    /** Subtract */
    Vector4f Subtract( Vector4f &v ) const;

    /** Dot Product of two vectors */
    float DotProduct( Vector4f &v );


    /** Angle between two vectors */
    float Angle( Vector4f &v );

    /** Set the vector */
    void Set( float x, float y, float z, float w );
    void Set( float* v );
    void Set( const Vector4f &v );

    /** Get the vector data */
    float* GetData() { return m_data; };

private:
    float   m_data[4];
public:
    virtual ~Vector4f(void){};
};
